package com.android.UrbanRemix;

/**
 * An instance of this class is created for every marker received from the database.
 * It extends OverlayItem so it can be put onto the map directly.
 * @author BD
 */
import com.google.android.maps.GeoPoint;
import com.google.android.maps.OverlayItem;

public class DatabaseItem extends OverlayItem {

	private String ImageURL;
	private String SoundURL;

	public DatabaseItem(int latitudeE6, int longitudeE6, String sound,
			String image) {
		// super is called with GeoPoint, title and snippet information.
		super(new GeoPoint(latitudeE6, longitudeE6), null, null);
		this.SoundURL = sound;
		this.ImageURL = image;
	}

	public String getImageURL() {
		String defaultImage = "http://gadgetynews.com/wp-content/uploads/2009/04/android-300x300.jpg";
		if (ImageURL == null || !ImageURL.contains("http"))
			return defaultImage;
		else
			return ImageURL;
	}

	public String getSoundURL() {
		// Change the wav to mp3 for streaming
		this.SoundURL = this.SoundURL.replace(".wav", ".mp3");
		return this.SoundURL;
	}

	@Override
	public String toString() {
		return "DatabaseItem [ImageURL=" + ImageURL + ", SoundURL=" + SoundURL
				+ ", mPoint=" + mPoint + "]";
	}

}
